﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ViewModelMapper
{
    using System.Linq.Expressions;

    public class DirectedMap<T, U> : Map<T, U>
    {
        public DirectedMap(Expression<Func<T, object>> from, Expression<Func<U, object>> to, Direction direction)
            : base(from)
        {
            this.MapTo = to;
            this.Direction = direction;
            this.Constraint = (vm, m) => true;
        }

        public ConstrainedMap<T, U> When(Func<T, U, bool> constraint)
        {
            return new ConstrainedMap<T, U>(MapFrom, MapTo, constraint, Direction);
        }
    }
}
